@extends('layout.main')
@section('content')
    <el-row id="index">
        <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item> 运营管理-每日排行获奖查询</el-breadcrumb-item>
        </el-breadcrumb>
        <el-form action="/operate/dailyRankRecord" method="get" :model="searchForm" :rules="searchRules" ref="searchForm" label-width="150px" inline="true">
            <el-form-item label="日期"  prop="loginTime">
                <el-date-picker @change="dateChange" range-separator='--' v-model="searchForm.loginTime" type="daterange" placeholder="选择日期范围"></el-date-picker>
                <input id="loginTime" type="hidden" name="loginTime" value="{{isset($searchParams['loginTime']) ? $searchParams['loginTime'] : ''}}">
            </el-form-item>
            <el-form-item label="用户ID">
                <el-input name="userID" placeholder="用户ID" v-model="searchForm.userID"></el-input>
            </el-form-item>
            <el-form-item label="游戏ID">
                <el-input name="gameID" placeholder="游戏ID" v-model="searchForm.gameID"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button native-type="submit" @click="submitForm('searchForm')">查询</el-button>
            </el-form-item>
        </el-form>
        <el-table :data="tableData" border min-height="300" style="width: 100%">
            <el-table-column label="日期" width="250">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.inserttime}}</span>
                </template>
            </el-table-column>
            <el-table-column label="比赛场" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.game_room.ServerName}}</span>
                </template>
            </el-table-column>
            <el-table-column label="用户ID" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.userID}}</span>
                </template>
            </el-table-column>
            <el-table-column label="游戏ID" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.account_info.GameID}}</span>
                </template>
            </el-table-column>
            <el-table-column label="用户昵称" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.account_info.NickName}}</span>
                </template>
            </el-table-column>
            <el-table-column label="获奖道具" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.item_info.Name}}</span>
                </template>
            </el-table-column>
            <el-table-column label="排名" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.rank}}</span>
                </template>
            </el-table-column>
        </el-table>
        <el-row tag="div" type="flex" class="" justify="end" style="margin-top:10px;">
            <el-pagination
            @size-change=""
            @current-change="pageChange"
            :current-page.sync="currentPageShow"
            :page-size="{{$pageSize}}"
            layout="total, prev, pager, next ,jumper"
            :total={{$total}}>
            </el-pagination>
        </el-row>
    </el-row>
    <script type="text/javascript">
        var showTime = {!! $RecordTimeShow ? $RecordTimeShow : "''" !!};
        var time_b = showTime ? new Date(showTime[0]) : '';
        var time_e = showTime ? new Date(showTime[1]) : '';
        var accountInfo = new Vue({
            el: '#index',
            data : {
                searchForm: {
                    userID : {!! (isset($searchParams['userID']) && $searchParams['userID']) ? $searchParams['userID'] : "''"  !!},
                    gameID : {!! (isset($searchParams['gameID']) && $searchParams['gameID']) ? $searchParams['gameID'] : "''"  !!},
                    loginTime: [time_b , time_e]
                },
                searchRules: {

                },
                currentPageShow:{{$currentPageShow}},
                tableData: {!!$item_list!!}
            },
            methods:{
                pageChange:function(currentPage){
                    var url = window.location.href;
                    var num=url.indexOf("?");
                    var new_url = '';
                    if(num == -1){ //没有任何参数
                        new_url = '?page='+currentPage;
                    }else {
                        url=url.substr(num+1); //取得所有参数
                        if(url.indexOf("page=") == -1){ //如果不存在page参数
                            new_url = '?'+url+'&page='+currentPage;
                        }else {
                            new_url = url.replace(/page\=\d+/, "page="+currentPage)
                            new_url = '?'+new_url;
                        }
                    }
                    new_url = '/operate/dailyRankRecord'+new_url;
                    window.location.href = new_url
                },
                dateChange:function(date){
                    $("#loginTime").val(date);
                }
            }
        });
    </script>
@endsection
